package txt2bib.util;

import java.lang.reflect.Field;

import java_cup.runtime.Symbol;

public class Util {
	public static String getSymbolHR(Symbol simbolo_attuale, Class<?> _class) 
	{
			try {
				Field fields[] =  _class.getFields();
				for ( int i = 0 ; i< fields.length ; i ++ )
				{
					fields[i].setAccessible(true);
					try {
						int a = Integer.parseInt(simbolo_attuale.toString().replace("#", ""));
						int b = Integer.parseInt((fields[i].get(null)).toString());
						if (a==b)
						{				
							return fields[i].getName();						
						}
					} catch (NumberFormatException e) {					
						e.printStackTrace();
					} catch (IllegalArgumentException e) {					
						e.printStackTrace();
					} catch (IllegalAccessException e) {					
						e.printStackTrace();
					}
				}
			} catch (Exception e) {
				
			} 
			
			return "NONE";
		}
}

